package com.jlcindia.jpa;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;

public class Lab3Client {
public static void main(String arg[])
{
	EntityTransaction tx = null;
	try
	{
		EntityManagerFactory factory = JPAUtil.getEntityManagerFactory();
		EntityManager manager = factory.createEntityManager();
		tx = manager.getTransaction();
		tx.begin();
		Customer cust = new Customer("Sumit","sumit@jlc.com",9999,"Blore"); 
		manager.persist(cust);
		tx.commit();
		manager.close();
	}
	catch(Exception e)
	{
		e.printStackTrace();
		if(tx!=null)
			tx.rollback();
	}
}
}
